<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/cloudiary.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Cloudiary</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<script type="text/javascript" src="Js/jquery.js"></script>
<script type="text/javascript" src="Js/login.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js?ver=1.4.2"></script>
<!-- InstanceEndEditable -->
<link href="CSS/css.css" rel="stylesheet" type="text/css" />
</head>

<?php
include("config.php");
if($_SERVER["REQUEST_METHOD"] == "POST")
{
	if(isset($_POST['check']))
	{

		if($_POST['email'] && $_POST['password'] && $_POST['passwordConfirmation'] && $_POST['username'] && $_POST['gender'] && $_POST['Date'] && $_POST['Month'] && $_POST['Year'] && $_POST['Country'] )
		{
		
			if($_POST['password'] == $_POST['passwordConfirmation'])
			{
				// username and password sent from Form 
				$myemail=addslashes($_POST['email']); 
				$mypassword=addslashes($_POST['password']); 
				$mypasswordConfirmation=addslashes($_POST['passwordConfirmation']);
				$myusername=addslashes($_POST['username']);
				$mygender=addslashes($_POST['gender']);
				$myday=addslashes($_POST['Date']);
				$mymonth=addslashes($_POST['Month']);
				$myyear=addslashes($_POST['Year']);
				$mydate = $myyear.'-'.$mymonth.'-'.$myday;
				$mycountry=addslashes($_POST['Country']);
				$joindate =date("Y-m-d"); 
				
				echo $sql="INSERT INTO user (user_email, user_name, user_password, user_gender, user_dob, user_country, user_account_restriction, user_join, is_admin) VALUES ('$myemail', '$myusername', '$mypassword', '$mygender', '$mydate', '$mycountry', 'public', '$joindate', 0)";

				mysql_query($sql);
						
				header("location: Login.php");
				
			}
			
			
		}

	}

}


?>
<body>
<div id="container">
<div id="wrapper">

<div id="header">
<!-- InstanceBeginEditable name="header" -->
<div class="login">
<table border="0">
<tr>
<td>
<a href="#" id="loginButton"><span>Login</span><em></em></a>
<div style="clear:both"></div>
<div id="loginBox">                
<form id="loginForm" method="POST" action="Login.php">
<fieldset id="body">

<fieldset>

<input type="email" name="email" id="email" placeholder="Email Address" />
</fieldset>

<fieldset>
<input type="password" name="password" id="password" placeholder="Password" />
</fieldset>

<input type="submit" id="login" value="Login" />
</fieldset>
</form>
</div>
</td>
<td>
<a href="Register.php" id="registerButton"><span>Register</span></a>
</td>
</tr>
</table>
</div>
<!-- InstanceEndEditable -->

<img src="Assets/cloud diary low-01(trans).png" alt="CloudDiary" width="75" height="45" style="padding:5px 10px;" /> <br />
</div>

<div id="main">
	<!-- InstanceBeginEditable name="Main" -->
    <p> <h2 align="center"> REGISTRATION PAGE </h2> </p>
    
    <form name="registration" id="form" method="POST">
      
      <label> <span> Username* </span>
      <input type="text" name="username" class="blank" autofocus required /> </label>
      
      <label> <span> Password* </span>
      <input type="password" name="password" class="blank" required /> </label>
      
      <label> <span> Password Confirmation* </span>
      <input type="password" name="passwordConfirmation" class="blank" required /> </label>
      
      <label> <span> Email address* </span>
      <input type="email" name="email" class="blank" required /> </label>
      
      <label> <span> Gender </span>
		<select name="gender" class="blank">
          <option> Male </option>
          <option> Female </option>
		</select> </label>
      
      <label> <span> Date of Birth* </span>
		<select name="Date">
		<option> 1 </option>
		<option> 2 </option>
		<option> 3 </option>
		<option> 4 </option>
		<option> 5 </option>
		<option> 6 </option>
		<option> 7 </option>
		<option> 8 </option>
		<option> 9 </option>
		<option> 10 </option>
		<option> 11 </option>
		<option> 12 </option>
		<option> 13 </option>
		<option> 14 </option>
		<option> 15 </option>
		<option> 16 </option>
		<option> 17 </option>
		<option> 18 </option>
		<option> 19 </option>
		<option> 20 </option>
		<option> 21 </option>
		<option> 22 </option>
		<option> 23 </option>
		<option> 24 </option>
		<option> 25 </option>
		<option> 26 </option>
		<option> 27 </option>
		<option> 28 </option>
		<option> 29 </option>
		<option> 30 </option>
		<option> 31 </option>
		</select> &nbsp;
		
		<select name="Month">
		<option value= "1"> January </option>
		<option value= "2"> February </option>
		<option value= "3"> March </option>
		<option value= "4"> April </option>
		<option value= "5"> May </option>
		<option value= "6"> June </option>
		<option value= "7"> July </option>
		<option value= "8"> August </option>
		<option value= "9"> September </option>
		<option value= "10"> October </option>
		<option value= "11"> November </option>
		<option value= "12"> December </option>
		</select> &nbsp;
		
		<select name="Year">
		<option> 1980 </option>
		<option> 1981 </option>
		<option> 1982 </option>
		<option> 1983 </option>
		<option> 1984 </option>
		<option> 1985 </option>
		<option> 1986 </option>
		<option> 1987 </option>
		<option> 1988 </option>
		<option> 1989 </option>
		<option> 1990 </option>
		<option> 1991 </option>
		<option> 1992 </option>
		<option> 1993 </option>
		<option> 1994 </option>
		<option> 1995 </option>
		<option> 1996 </option>
		<option> 1997 </option>
		<option> 1998 </option>
		<option> 1999 </option>
		<option> 2000 </option>
		<option> 2001 </option>
		<option> 2002 </option>
		<option> 2003 </option>
		<option> 2004 </option>
		<option> 2005 </option>
		<option> 2006 </option>
		<option> 2007 </option>
		<option> 2008 </option>
		<option> 2009 </option>
		<option> 2010 </option>
		<option> 2011 </option>
		<option> 2012 </option>
	  </select> </label>
      
	<label> <span> Country </span>
        <input type="text" name="Country" class="blank" />
      </label>
      
	  <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p>
	  
      <p>
      <input type="checkbox" required name="check" /> I agree with the 
      <a href="terms_and_condition_page.php"> Terms and Conditions </a> of Cloud Diary

      <br />
      * Mandatory fields </p>
      <br />
	 
      <p align="right"> <input type="image" name="submit" value="submit" src="Assets/buttonSubmit.png" alt="Submit" /> </p>
    
    </form>
    
	<!-- InstanceEndEditable -->
</div>

</div>
</div>

<div id="footer">
<p align="center"> &copy; &nbsp; 2012 CloudDiary </p>
</div>
</body>
<!-- InstanceEnd --></html>